package com.accp.demo.controller.sale;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.accp.demo.pojo.sale.SaleOrder;
import com.accp.demo.pojo.sale.SaleOrderDetail;
import com.accp.demo.service.sale.SaleOrderservice;

@RestController
@RequestMapping("/order/")
public class SaleOrdercontroller {
	@Autowired
private SaleOrderservice orderservice;

	/**
	 * 分页主祥查询
	 */
	@RequestMapping("queryPagesaleOrder")
	@ResponseBody
	public List<SaleOrder> queryPagesaleOrder(Integer pageNum,Integer pageSize){
		return orderservice.queryPagesaleOrder(pageNum, pageSize);
	}
	/**
	 * 主祥新增
	 */
	@RequestMapping("saveOrUpdate")
	@ResponseBody
	public Object saveSaleorder(@RequestBody Map<String,Object> map){
		return orderservice.saveSaleorder(map);
	}
	/**
	 * 查询最大的单号
	 */
	@RequestMapping("getNewNo")
	@ResponseBody
	public String orderDanhao(@RequestParam Map<String,Object> map){
		return orderservice.orderDanhao(map);
	}
	/**
	 * 删除
	 */
	@RequestMapping("deleteSaleorder")
	@ResponseBody
	public void deleteSaleorder(String saleid){
		orderservice.deleteSaleorder(saleid);
	}
	/**
	 * 根据订单编号查询主祥
	 */
	@RequestMapping("querysaleOrderall")
	@ResponseBody
	public SaleOrder querysaleOrderall(String saleid){
		return orderservice.querysaleOrderall(saleid);
	}
	/**
	 * 分页查询pageBean
	 * @param map
	 * @return
	 */
	@RequestMapping("queryBypage")
	@ResponseBody
	public Object queryBypage(Integer page,Integer limit){
		System.out.println(page);
		return orderservice.queryByPage(page,1);
	}
	/**
	 * 根据主表编号查询项表记录
	 */
	@RequestMapping("querySaleOrderDetailall")
	@ResponseBody
	public List<SaleOrderDetail> querySaleOrderDetailall(String saleid){
		return orderservice.querySaleOrderDetailall(saleid);
	}
	/**
	 * 反审核审核
	 */
	@RequestMapping("updatedate")
	@ResponseBody
	public void updatedate(Integer auditState, String auditTime,String permitter,String billNo){
		orderservice.updatedate(auditState, auditTime, permitter, billNo);
	}
}
